bb.edn sci/eval-string not in user namespace

Open
#2,005 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
clojure
Domain
cli

Research direction

Start by reproducing the babashka task shown in the issue and compare it with the standalone sci/eval-string example. Trace the sci/eval-string entry point and namespace handling; done means the documented expression works in babashka without injecting (ns user).

Written by the indexing model from the issue text.

Description

version
v1.13.219

platform

ubuntu ~24.04.1

problem

This code is documented and works in clj

(ns tst
  (:require [sci.core :as sci]))

(sci/eval-string "(println(f [1 2 3]))" {:namespaces
                                                {'clojure.core {'println println}
                                                 'user {'f first}}})

for babashka (ns user) must be injected

{:tasks
 {a {:requires ([sci.core :as sci])
     :task
     (do
       (sci/eval-string "(ns user)              ;; !!!! user 
                         (println(f [1 2 3]))" {:namespaces
                                                {'clojure.core {'println println}
                                                 'user {'f first}}}))}}}
Dominant language
Clojure
Stars
4.7k
Forks
286
Avg merge
3m
Merged PRs (30d)
23

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from babashka/babashka

All issues in babashka/babashka

Similar issues

More Clojure issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.