Is there a Brainfuck API? - brainfuck

So I stumbled upon a Brainfuck question, and I wondered, do any of its compilers/interpreters provide an API?
I'll make a separate question about accessing other APIs.

In pure Brainfuck, there won't be anything, unless you write your own interpreter that uses specific chunks of memory for this.
One project that may interest you is ajyoon/systemf, an interpreter where you can make Linux system calls using a special ninth character.
EDIT: I ended up answering the wrong question of the asker, this is more an answer to the other one.

Related

Does some Brainfuck compiler/intepreter provide a mean to access an API?

Again, I stumbled upon a Brainfuck question, and I wondered, do any of its compilers/interpreters provide a way to access some API (the system one, or individual functions from a dll, and so on)?
Note: I already asked about APIs provided directly by the compiler/interpreter in this other question.
As Thomas Jager pointed out , yes, systemf provides access to Linux syscalls.

REST Server in TCL

I would like to add a REST interface to an existing TCL codebase (so that the programms in other language can use the existing TCL code).
I found a list of Webserver with TCL support but I have no idea which one would be a good solution to quickly map our TCL functions to HTTP/REST calls without tons of boilerplate code.
Has anyone here already done something like this and can tell me which of these servers would be a good (or bad/difficult) solution?
Is there maybe another server/framework that is even better for this use case?
Consider Naviserver. Tcl is its embedded interpreter language. It has a low profile memory overhead, and is regularly maintained and tested for performance and low latency.
For what you’re describing, you might consider Wapp. It’ll do exactly the boilerplate elimination you want, and it’s easy to dive into. You’d probably want to use it as a library, rather than an app, given that you’ve got an existing codebase, but its operation past the initial setup is the same for that use case.

Which language for my dissertation project? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
I am doing my dissertation project on NP-Hard Problems: I am going to implement various algorithms for problems such as the partition, the subset sum, the knapsack, etc and then compare the results, the running time, etc. Also, I am going to see what happens with the algorithms when you modify the problem (how does the algorithm behave on the reduced problem, etc).
Now I picked this topic as my project because I am interested in theoretical computer science but I am also not sure if I want to go on as an academic/researcher or join a company/startup and this project has both a theoretical and a practical (actual coding) side.
My question is, which programming language should I use? Should I stick to what I feel more familiar with (Java and maybe Python), or should I go with the web languages (HTML, CSS, PHP, RoR, etc), having in mind that web development skills are on high demand nowadays?
EDIT: HTML and CSS would be obviously used just for the UI.
I want my project to be something that will impress in an interview (for either a job or a masters course) and I am not confident that "yet another project in Java" can do that. I understand that as long as the work on it is good and the result is satisfactory I should be ok but if, let's say, using Ruby can give me some points I am totally going with that. In the same time, I understand that deciding which language to use is part of the project so I am not willing to complicate things just to try and look cool.
Thanks in advance!
EDIT: In case this changes any of the answers, this is a undergrad. dissertation project, not a PhD one.
First of all this is a subjective question, not perfectly suitable for SO, but we forgive you :)
Contrary to popular opinion here (looking at the previous answers), if you're trying to solve NP-Hard problems, I would definitely not write the programs in C or C++. Mainly because dynamic programming methods tend to look like absolute dog poop when written in low-level languages. For example, here's someone's dynamic programming solution to the knapsack problem: http://www.joshuarobinson.net/docs/knapsack.html.
It's well-written and well-formed, but barely readable simply due to the sheer amount of malloc, memcpy, and free you need to do. Go with Java or Python, no question about it. You want people to actually read (and maybe even enjoy?) your dissertation, I would assume.
Don't write it in PHP or Ruby because those languages aren't particularly applicable to computer science theory. With that said, if you're applying for a web-dev job and you're trying to impress your future employees with a knapsack problem or dynamic programming NP-Hard solvers, it's like shooting a sparrow with a cannonball.
If your project's subject is impressive, no one will care what language it's in. Do it in the language you feel is appropriate for the task. Knowing how to make the appropriate language choice and defending that choice should be more impressive than "OMG I used RoR XSL ActionScript CSS!!!"
Also, how long do anticipate this project will take? If you go with a language that's flashy and trendy today, do you know it will still be cool and popular when this project wraps up? Just saying in another way, popularity is not the reason to choose the language for something like this.
if you can invest effort and time, then i recommend c/c++. it will be an impressive add-on skill.
My language of preference would be Python. You could use Django and, in my opinion, it would be very applicable to things that are being done in the industry (especially with startups). Plus, you can't beat Python when it comes to readability and speed of development.
I would have thought that Python would be doing too much clever stuff under the hood to really be able to measure relative performance accurately.
Wouldn't it be better to use a lower-level language like C? Employers would respect you more for that than using something because it's "cool".
The languages you know look fine to me. The old saw is that a CS PhD makes you unemployable anyway, so I wouldn't worry about it. :-)
The other ones you mentioned are mostly specialized web presentation languages. I'm not real sure how one even goes about implementing the knapsack problem using CSS...
Well, as much as this might look fine on the web page, it seems to me that Java would do a better job doing what you need.
PHP, HTML and CSS knowledge is good for job finding, but not applicable very much on the subject you picked.
Also, I noticed a bunch of answers, so I guess this is a question very much related to personal taste and opinion. Hm... You asked for it, anyways ;)
Since you're already familiar with Python, I'd recommend using it. You can use the popular scipy and numpy libraries for your project. You'll probably find something of use in them.
That would be the core, or backend part of your project. When this part is finished, you should think about polish and presentation. You don't want to have an impressive looking presentation with wrong calculations.

Are you taking up Perl and what got you into it? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I got into Perl years ago and always found it a fun and expressive language to work with.
I found that programming in Perl makes me quite productive thanks to its low overhead and the outstanding amount of ready-made solutions to common problems on CPAN.
If you're new to Perl, what got you into it?
I was coding PHP for a living, and then heard of their change from :: to \ as a name-space separator. I'm really not joking or being spiteful, but that is really what got the ball rolling.
Not to be elitist, but I suddenly realised that the people I had to collaborate with whom knew PHP understood very little in programming concepts in ways that frustrated me how they could be so blind, the people in the IRC rooms for it were no longer a source of help for my questions, and I usually spent more time answering questions and waiting for somebody to turn up whom could answer mine. Usually I ended up solving it myself.
Most the time I realised was people re-solving the same problems over and over again in increasingly bad ways.
I discovered problematic behaviours in PHP which defied logic and reasoning (like the array_merge_recursive family), and discovered functions that were undocumented in how to use them, and when I reported a bug in the functions, my bug was marked as "Bogus" and I was expected to be psychic.
I had a friend whom was constantly proclaiming the goodness of Perl, so I basically gave it a shot and now am hooked like an addict.
Additionally, my experience in other higher-order dynamically typed languages (JavaScript and Ruby, yes, JavaScript is a more powerful language than PHP in terms of language features) left me a knowledge with many ways to solve types of problems easily, but being restricted in such a way I had no way to use these powerful features. Perl satisfied this need.
Why Perl and not Ruby? I've played with Ruby a bit, but my experience taught me the support and documentation is sparse, the language is slow and immature. Nice it may be, but its still in diminished in capacity against Perl from what I've seen. And it shared PHPs major flaw that it has a huge user base comprised of total novices all doing things the wrong way, and I really wanted to not have to deal with that so much.
It's not nice to be elitist, but once you have tried to explain the same thing to 30 people (and taken an hour to get a simple concept into their heads every time) it reaches a point of frustration. (I can't cope with the 'There is somebody on the internet who is wrong' situation, If I can't SEE it, it doesn't happen)
I started doing Perl during my third year in computer science as a part of 'Scripting languages' course. I have a friend studying biotechnology and I helped her with some data mining scripts for dealing with protein databases (parsing text files, regexps, simple integrity checks). It was all very natural to do in Perl.
Then I got my first part-time job and had to use it professionally. I was responsible for developing set of batch scripts that handled some part of business logic in the company. And it was the task where Perl revealed all its potential. Need to get data from DB? - no problem, just go to CPAN. Need to automate wiki - no problem, go to CPAN. The amount of already created modules is overwhelming and you can be sure you will always find what you need in CPAN.
To sum up. For me, Perl is a swiss army knife of scripting languages. Everything can be done in it and it has huge number of additional modules even for very exotic tasks. And by the way, did I mention REGEXPS?
With Perl (and the expressive power behind TMTOWTDI), programming becomes a creative task. I can write if($expr) { $statement; } if I plan on having many else statements, or I can write $statement if $expr; if that makes more sense (for example, I'm fond of writing:
sub doSomething {
my($toObject, $argument) = #_;
die "No object specified" unless defined($toObject);
die "Object invalid: $toObject" unless $toObject->ISA('Example');
# Do stuff
}
but of course that's not always the easiest, and most expressive way of doing it; so I come up with a better way for the task at hand!). People complain because Perl lets you write horrible looking code; I love Perl because it lets me write code which looks pretty to me (and yes, I can see the downside of having a dozen different programmers writing in their own styles; I'll hold to the idea that good writers can be pretty expressive and understandable no matter how different the subject matter).
With other programming languages, I end up having to think my way through abstraction layers (how will this Map give me Collections whose Iterators I can use to ... and so on). With Perl, I'm usually only one abstraction level above basic Perl. For instance, DBI will give me database results as ordinary, everyday Perl scalars, lists and hashes, so everything I know about these simple, core data structures carries over to every task I put DBI to (Complicated data structures? That's what PostgreSQL is for!).
I've only been using Perl full-time for about a year, but these are the big wins for me, and the reason I first went full-time onto Perl after a year suffering at the hands of Java 1.4's Collections model (don't ask). Other programming languages make me feel like I'm putting together a jigsaw puzzle, as you line up all the modules and packages just right; Perl feels like a box full of Legos, with some "special" bricks (like DBI, CGI.pm and Test::*) thrown in for good measure. There are tons of different ways to solve any problem, and Perl lets you try any of them you like, in any way you like.
I'm still not that long time in the Perl community and what me first brought in was Larry Wall's humor and wisdom. True, Perl has it quirks but the language comes from an understanding of things that is very close to mine so I'm much less comfortable with Python and to a lesser degree Ruby.
I don't do web app's more GUI with WxPerl and it works just fine. I'm very interested in languages also in lesser known like factor, boo, rebol and so on but all in all is Perl my choice. and it's because a mixture of powerful syntax (can be very functional if you like it), the community, CPAN of course, and, like I said before, due to the cosy feeling being in the right place.
Perl is its community, which is the reason to use it both on a social and practical level. (See CPAN and Perlmonks, which likely inspired SO.)
There's a lot of freedom when coding in Perl; you can write some wicked-crazy unreadable hacks, but it doesn't take long once you've gotten a feel for the language (and learned how to use perltidy :-) ) before you realize that well-written perl code can look downright pretty.
It's interesting; I ended up as a full-time Perl programmer after learning it for my sysadmin-type job in college; and now it's my strongest skill. I'm going to stick with Perl for a while because so far the language has been versatile to grow with me. I write a lot of systems software in Perl, and decided to pick up web programming for fun, and Catalyst was there waiting for me. Do I want to try out a new language paradigm? Perl will probably support it. In contrast, when I was coding in PHP for a time, I immediately felt like I was pressing against a glass ceiling.
I work as a technological troubleshooter for a big organization in southern OH. I had to learn Perl to keep some automated network text manipulation systems up and running and eventually got a little excited about it. I eventually thought of myself as a developer and wrote some programs that parsed some database data and made some people’s lives a little easier. But after reading some of the posts on this website and listening to the stackoverflow podcast and even starting to read the book Code Complete from someone’s suggested reading list I no longer have any delusions that I was a developer of Perl or any other language for that matter. However, maybe someday I could be.
I had used awk a few time for shell scripts way, way back in the days. In one ancient project we needed to implement the a TELNET protocol connection, so I wrote a quick version in Perl 4. It worked really well, and I started to really like the language.
Later, I wrote a big full commercial web application in Perl 5, complete with it's own framework and database. I was careful not to use to many of Perl's more esoteric features, so the code looked more like C than Perl. It worked really well, performance was good and the code was easily extended.
Recently I've been working in Java, but I often find myself missing the Perl's loose typing, and its ability to encapsulate things way better than Java. My favorite features were being able to put Perl datastructures (arrays and hashes) and code directly in config files and execute them, and the ability to tie code to syntax like arrays. Both lead to some really slick code.
Paul.
simple syntax, powerful scripting capabilities for win32 and unix systems, and totally powerful regex!
I pickup Perl on my first job where I had to write plenty of automation script for electrical engineers to mine datalogs and format them to Excel and sometimes deal with sql server too. With Perl I could usually get something working rather quickly, so all is good in the manufacturing land. :P
I started using Perl as an enhancement to our build process for embedded development. We needed to develop diverse outputs based on our cross compiled payload and Perl was a great fit.
Our enhancements included floating-point to hexadecimal conversion, S-record post-processing, and checksum modifications.
Not that this kind of work can't be done with many other tools, but I would definitely recommend Perl for build-related work.
What brought me to Perl was when I saw the DBI and realized that I could write the ESQL/C programs I was writing at the time in one fifth the time.
What has kept me using Perl is that the two other languages likely to unseat it are both strongly typed. That is
print "10" + 5;
is a type error rather than 15.
I'm not taking it up. I had to work on a project in Perl a few years ago, and I came to really dislike the language. It has a sometimes-awkward syntax and a lot of crazy gotchas that I found hard to work with. Honestly, I think Ruby has superseded Perl in many respects: it's good at roughly the same things, but has much nicer features and is easier to use.
Perl still has CPAN, though, which even Ruby can't match (although Ruby has a lot of useful libraries, too).
I considered learning Perl last year.
It was the only technologies that I actively decided not to learn. This is nothing directly against the language itself, it just seemed that I would be coming to the party 10 years too late. It is very useful for the shell scripting tasks that it was designed for but for me personally I prefer languages with a stronger coherence.
Perl 6 seems like it's on indefinite hiatus and even when it arrives I don't believe that it will make the language profoundly more compelling.
Also, Larry Wall scares me.
For my situation Perl wasn't the right choice and thats why.
Perl is not as bad as I thought. I used to use it in a couple customer scripts about one year ago, and even grew to like it a bit. Then again, I've never ever missed it since.
The reason? It's mostly a write-only language. Going above a 100 line solution made me be wary of my own code, which is definately not a good outcome. With other languages that bar is considerably higher (maybe 1000 or 10000 lines).
I see no reason to go for Perl in new projects, for new users, in -soon- 2009.

How to go about learning perl [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am a bioinformatics student and am in the process of learning perl. I don't have a strong programming background but would like for that to change.
Right now I am in the process of reading/following and coding from this book
I want to know is this the best way to go about learning perl? Should I be experimenting with regular expressions more? Should I keep trying writing sample perl scripts?
Related: what are good books for learning perl
The definitive learning Perl book is aptly called "Learning Perl". Get it.
I cannot recommend writing sample scripts. Try to write something that you need. It doesn't have to be a big endeavor; everyone needs a little tool now and then. Writing sample scripts is boring; always was, always will be.
This seems like a potential duplicate as here are some related questions:
What are the best resources to starting learning Perl?
What’s the best online source to learn Perl?
Like most other answers on this post I can't disagree with the choice of "Learning Perl" as your first Perl text. Keep a copy of the perldoc documentation available for quick reference(I prefer using the html/pdf format which is available as a download from the main page).
In order to keep things from getting boring, especially in the initial stages I started converting my shell scripts to Perl, hacking away at it until I had three or more different versions of the same program with decreasing file size(not great for maintenance though). But then you know what they say - TMTOWTDI. Now I don't bother with shell scripts any more, writing it in Perl results in smaller turnaround times and the code can be easily reused and enhanced.
Once you are familiar with the more advanced concepts and are approaching a level of comfortability with using it for your day-to-day work or just simple one-liners you might want to have a look at Mark Jason Dominus' Higher-Order Perl which, according to me, takes the language and the reader's understanding of it to an entirely new level. The chapter on "Recursion and Callbacks" was a real eye-opener and changed my style completely from that of writing C-programs in Perl to actually writing "Perl" programs in Perl.
I use the online book "Learning Perl the Hard Way" to teach my coworkers about Perl.
Don't be intimidated by the title, it's just that it's directed at programmers who are already fluent in another language and therefore it doesn't focus on the programming part, but mostly on the Perl part, so it may apply better to your case (or not).
You really can't go wrong with the Lama book
Learning Perl
There's quite a library of O'Reilly books on Perl. Programming Perl is also excellent and probably worth having to complement the Lama book - I have both on my shelves and although I haven't needed to code in Perl for quite some time I found these books together a solid enough combination. The Perl Cookbook came in useful too (yes, this is one of those areas that O'Reilly has pretty much sew up :-).
As to practical exercises, Perl does have something of a reputation as a 'Write Only' language, so look for clear examples and if you are confused by anything don't necessarily assume that the problem is you - there's always more than one way to do it.
You also might want to look for examples of good code to study.
My experience is that there's nothing better for learning than doing. But you need someone to provide feedback, especially when you hit roadblocks that you can't get past. Stackoverflow is good for that, but, IME, Perlmonks is better in that there is a chatterbox for immediate feedback, as well as their question-and-answer posts for longer questions, combined with a more specialised environment. (And Larry Wall has been rumoured to hang out there, too, as well as a number of the authors of the above-referred-to books.)
Learn by doing. Get the books mentioned by others, but the real way to learn is to start a simple project. Mine was a Gtk based SQL editor. If you run into problems ask questions here and on the Perl Beginners list.
The choice of book is can be vary from person to person. So, as bioinformatics student who use perl, don't get any book that called "(X Programming language) for bioinformatics". Usually this kind of book is either.
They only give very basic of that programming language. You gonna to miss all the power from that language.
Wasting its space on how to use API, which you can find information easily via google.